import { Entity, PrimaryColumn, Column, Index } from "typeorm";
import { ManualTimestamp } from "../decorators/manual-timestamp.decorator";

@Entity("market_stalls")
@ManualTimestamp()
export class StallEntity {
  @PrimaryColumn("int", { name: "role_id", comment: "摊主角色ID(即摊位ID)" })
  roleId!: number;

  @Column("varchar", {
    length: 100,
    name: "name",
    comment: "摊位名称",
    default: "",
  })
  name!: string;

  @Column("varchar", {
    length: 100,
    name: "role_name",
    comment: "摊主角色名",
    default: "",
  })
  roleName!: string;

  @Column("int", { name: "pv", comment: "浏览次数", default: 0 })
  pv!: number;

  @Column("tinyint", {
    name: "state",
    comment: "状态: 0-待上架,1-已发布",
    default: 0,
  })
  state!: number;

  @Column("tinyint", {
    name: "type",
    comment: "发布类型: 1-普通,2-打包",
    default: 1,
  })
  type!: number;

  @Column("int", {
    name: "money",
    comment: "打包价格(银两), 普通发布为0",
    default: 0,
  })
  money!: number;

  @Index()
  @Column("datetime", { name: "created_at", comment: "创建时间" })
  created_at!: Date;

  @Column("datetime", {
    name: "updated_at",
    nullable: true,
    comment: "更新时间",
  })
  updated_at!: Date | null;
}
